""" 补码问题，进制问题 
lstrip方法"""
def toHex(num: int) -> str:   
    if num == 0: return '0'
    ret = []
    template = '0123456789abcdef'
    for _ in range(8):
        ret.append(template[num%16])
        num //= 16
    return ''.join(ret[::-1]).lstrip('0')